package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_Prize 抽奖
 *
 */
public class TestData_TB_Prize
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_Prize saveMust(
		org.springframework.context.ApplicationContext context
		
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_Prize");
		return (TB_Prize)repository.save(newMust(
				
			));
	}
	
	public static TB_Prize newMust(
		
	){
		return new TB_Prize(new TB_Prize.MustProperties() {
			/** 名称 */
			@Override public String getName(){
				return Generator.generate(0, 100);
			}
			/** 文档 */
			@Override public String getFileUrl(){
				return Generator.generate(0, 100);
			}
			/** 类型 */
			@Override public String getType(){
				return Generator.generate(0, 8);
			}
			/** 原名称 */
			@Override public String getOriginalName(){
				return Generator.generate(0, 100);
			}
			/** 大小 */
			@Override public Double getSize(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
			/** 标题 */
			@Override public String getTitle(){
				return Generator.generate(0, 100);
			}
			/** 状态 */
			@Override public bairui.international.model.status.State_Prize getState(){
				return bairui.international.model.status.State_Prize.Draft;
			}
			/** 计划结束时间 */
			@Override public java.util.Date getFinishTime(){
				return new java.util.Date();
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_Prize saveAll(
		org.springframework.context.ApplicationContext context
		
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_Prize");
		return (TB_Prize)repository.save(newAll(
				
			));
	}
	
	public static TB_Prize newAll(
		
	){
		return new TB_Prize(
			new TB_Prize.MustProperties() {
				/** 名称 */
				@Override public String getName(){
					return Generator.generate(0, 100);
				}
				/** 文档 */
				@Override public String getFileUrl(){
					return Generator.generate(0, 100);
				}
				/** 类型 */
				@Override public String getType(){
					return Generator.generate(0, 8);
				}
				/** 原名称 */
				@Override public String getOriginalName(){
					return Generator.generate(0, 100);
				}
				/** 大小 */
				@Override public Double getSize(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 标题 */
				@Override public String getTitle(){
					return Generator.generate(0, 100);
				}
				/** 状态 */
				@Override public bairui.international.model.status.State_Prize getState(){
					return bairui.international.model.status.State_Prize.Draft;
				}
				/** 计划结束时间 */
				@Override public java.util.Date getFinishTime(){
					return new java.util.Date();
				}
			},
			new TB_Prize.OptionalSingleProperties() {
				/** 说明 */
				@Override public String getContent(){
					return Generator.generate(0, 20000);
				}
				/** 实际结束时间 */
				@Override public java.util.Date getRealFinishTime(){
					return new java.util.Date();
				}
				/** 发布时间 */
				@Override public java.util.Date getPublishTime(){
					return new java.util.Date();
				}
				/** 强制结束标志 */
				@Override public Boolean getForceFinishFlag(){
					return new java.util.Random().nextBoolean();
				}
			}
		);
	}
	

}
